package com.pounds.control;

import com.pounds.pojo.Order;
import com.pounds.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("harryserver/order")
public class OrderControl {

    @Autowired
    private OrderService orderService;

    @GetMapping("user_order")
    public List<Order> getUserOrder(String account) {
        return orderService.getUserOrder(account);
    }

    @PostMapping("new_order")
    public void newOrder(String account,String name,String price){
        orderService.newOrder(account,name, price);
    }
}
